package com.ljh.mapper;

import com.ljh.pojo.Dinding;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ljh.vo.Dindingshow;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 刘剑鸿
 * @since 2021-09-15
 */
@Mapper
@Repository
public interface DindingMapper extends BaseMapper<Dinding> {

    @Select("select a.*,b.* from dinding a,diningtype b where a.diningtypeid = b.diningtypeid and a.floorsid = '1'")
    List<Dinding> showAll();
    @Select("select a.*,b.* from dinding a,diningtype b where a.diningtypeid = b.diningtypeid and a.floorsid = '2'")
    List<Dinding> showAlltwo();
    @Select("select a.*,b.* from dinding a,diningtype b where a.diningtypeid = b.diningtypeid and a.floorsid = '3'")
    List<Dinding> selectAllthree();

    @Select("select count(diningstateid) from dinding WHERE diningstateid = '1'")
    int getkaicount();

    @Select("select count(diningstateid) from dinding WHERE diningstateid = '2'")
    int getyudCount();

    @Select("select count(diningstateid) from dinding WHERE diningstateid = '3'")
    int getkoncount();

    @Select("select count(diningstateid) from dinding WHERE diningstateid = '4'")
    int gettingcount();

    @Select("select * from dinding where floorsid = #{floorsid} and diningstateid = '3'")
    List<Dinding> selectListOut(@Param("floorsid") int id);

    @Update("update dinding set diningstateid = '1' where dining_tableid = #{id}")
    void updateBydingId(@Param("id") Integer dindingId);
    @Update("update dinding set diningstateid = '2' where dining_tableid = #{id}")
    void updateByResdingId(@Param("id") Integer ResDindingId);

    @Update("update dinding set diningstateid = '3' where dining_tableid = #{id}")
    void updateByding(@Param("id") Integer id);

    @Update("update dinding set diningstateid = '4' where dining_tableid = #{id}")
    void updateByting(@Param("id") Integer id);
    List<Dinding> selectStopList();
}
